#include <stdio.h>
#include "spi_protocol.h"

int main(void)
{
    uint8_t read_data;
    
    // 初始化SPI
    if(spi_init() != SPI_SUCCESS) {
        printf("SPI initialization failed\n");
        return -1;
    }
    
    // 写寄存器测试
    printf("Writing register...\n");
    if(spi_reg_write(0x1FF, 0x55) == SPI_SUCCESS) {
        printf("Register write successful\n");
    }
    
    // 读寄存器测试
    printf("Reading register...\n");
    if(spi_reg_read(0x1FF, &read_data) == SPI_SUCCESS) {
        printf("Read value: 0x%02X\n", read_data);
    }
    
    return 0;
} 